package com.springboot.demo.utils;


import lombok.extern.slf4j.Slf4j;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.IOException;
import java.io.PrintWriter;
import java.io.StringWriter;

/**
 * @author wubc683
 * @desc 异常信息文件工具类
 * @date 2021-08-09 17:13
 */

//@Slf4j
//public class ExceptionUtil {
//    private static final Logger logger = LoggerFactory.getLogger(ExceptionUtil.class);
//    /**
//     * 打印异常信息
//     */
//    public static String getMessage(Exception e) {
//        String swStr = null;
//        try (StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw)) {
//            e.printStackTrace(pw);
//            pw.flush();
//            sw.flush();
//            swStr = sw.toString();
//        } catch (IOException ex) {
//            ex.printStackTrace();
//            logger.error(ex.getMessage());
//        }
//        return swStr;
//    }
//}